package com.haiyi.activiti.engine.framework.ruleengine;

import com.haiyi.activiti.engine.exception.ActivitiEngineException;

import java.text.MessageFormat;

/**
 * <p> </p>
 *
 * <pre> Created: 2018/12/6 17:38 </pre>
 *
 * @author hlu
 * @version 1.0
 * @since JDK 1.7
 */
public enum  RuleEngineEnum {
    ACTIVITI("0"),DROOLS("1");

    private String code;

    RuleEngineEnum(String code){
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public static RuleEngineEnum getByCode(String code) {
        for (RuleEngineEnum ele : values()) {
            if (ele.getCode().equals(code)) {
                return ele;
            }
        }

        throw new ActivitiEngineException(
                MessageFormat.format("根据code={0}查询对应的枚举ExchangeOpTypeEnum不存在", code));
    }
}
